package com.heima.wemedia.controller.v1;


import com.heima.model.admin.dtos.SenstitiveDto;
import com.heima.model.admin.pojos.AdSensitive;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.wemedia.service.WmSensitveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/sensitive")
public class WmSensitiveController {

    @Autowired
    private WmSensitveService wmSensitveService;

    /**
     * 分页查询敏感词列表
     * @return
     */
    @PostMapping("/list")
    public ResponseResult findList(@RequestBody SenstitiveDto dto){
        return wmSensitveService.findList(dto);
    }

    /**
     * 保存敏感词
     * @param adSensitive
     * @return
     */
    @PostMapping("/save")
    public ResponseResult saveSensitive(@RequestBody AdSensitive adSensitive){
        return wmSensitveService.saveSensitive(adSensitive);
    }

    /**
     * 修改敏感词
     * @param adSensitive
     * @return
     */
    @PostMapping("/update")
    public ResponseResult updateSensitive(@RequestBody AdSensitive adSensitive){
        return wmSensitveService.updateSentive(adSensitive);
    }

    /**
     * 删除敏感词
     * @param id
     * @return
     */
    @DeleteMapping("/del/{id}")
    public ResponseResult delSensitive(@PathVariable("id") Integer id){
        return wmSensitveService.delSensitive(id);
    }
}
